import java.util.Scanner;

public class menu {
    String[] menuItems = new String[] {
        "【1】查看学生信息", "【2】添加学生", "【3】删除学生", "【4】修改学生", "【5】根据学号查询", "【6】保存到文件", "【7】从文件中读入" ,"【8】退出系统"};

private Scanner sc = new Scanner(System.in);

// 打印头部
public void printHeader() {
   System.out.println("======================");
   System.out.println("欢迎使用学生信息管理系统！");
   System.out.println("======================");
}

public int getChoice() {
   int input = 0;
   
   for (String item : menuItems) {
       System.out.println(item);
   }
   System.out.println("======================");
   System.out.println("请输入序号功能：");
   
   do {
       input = sc.nextInt();
   }while(input <= 0 && input > 8);
   //System.out.println("您选择："+input);
   System.out.println("您选择："+menuItems[input-1]);
   
   return input;
}
}
